package Day08.demo1;

import java.util.HashMap;
import java.util.Scanner;

/**
 * @author chihb
 * @create-time 2024/7/4 13:39
 * @description
 */
public class Test {
    public static void main(String[] args) {
        HashMap<String,Integer> map=new HashMap<>();
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入商品名称，每行输入一个，以end结束");
        while (true) {
            String goods=sc.next();
            if("end".equals(goods)){
               break;
            }
            if(map.containsKey(goods)){
                map.put(goods,map.get((goods))+1);
            }else {
                map.put(goods,1);
            }
        }
        map.forEach((k,v)-> System.out.println(k+"======>"+v));
    }
}
